
package com.sxtyxt.widget.wheel.adapter;

import android.content.Context;

import com.sxtyxt.entity.City;
import com.sxtyxt.online.R;

import java.util.List;

public class MyCityAdapter extends AbstractWheelTextAdapter {

    private List<City> values;

    public MyCityAdapter(Context context, List<City> list) {
        super(context);
        this.values = list;
    }

    @Override
    public CharSequence getItemText(int index) {
        if (index >= 0 && index < values.size()) {
            return values.get(index).getAreaName();
        }
        return "";
    }

    @Override
    public int getItemsCount() {
        return values==null?0:values.size();
    }

    @Override
    public Object getItemTag(int index) {
        if (index >= 0 && index < values.size()) {
            return values.get(index).getAreaId();
        }
        return "";
    }

    @Override
    public int getItemResource() {
        return R.layout.wheel_item;
    }
}
